"use strict";
cc._RF.push(module, '418b9B+FQBJU6zwftqaDQsz', 'task_item_info');
// scripts/task_item_info.js

"use strict";

var e = require;
var t = module;
var o = exports;

var _ii,
    nn = void 0 && (void 0).__extends || (_ii = function ii(t, e) {
  return (_ii = Object.setPrototypeOf || {
    __proto__: []
  } instanceof Array && function (t, e) {
    t.__proto__ = e;
  } || function (t, e) {
    for (var o in e) {
      Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
    }
  })(t, e);
}, function (t, e) {
  function o() {
    this.constructor = t;
  }

  _ii(t, e), t.prototype = null === e ? Object.create(e) : (o.prototype = e.prototype, new o());
}),
    rr = void 0 && (void 0).__awaiter || function (t, e, o, i) {
  return new (o || (o = Promise))(function (n, a) {
    function r(t) {
      try {
        l(i.next(t));
      } catch (e) {
        a(e);
      }
    }

    function s(t) {
      try {
        l(i["throw"](t));
      } catch (e) {
        a(e);
      }
    }

    function l(t) {
      var e;
      t.done ? n(t.value) : (e = t.value, e instanceof o ? e : new o(function (t) {
        t(e);
      })).then(r, s);
    }

    l((i = i.apply(t, e || [])).next());
  });
};

var oo = void 0 && (void 0).__decorate || function (e, t, a, n) {
  var i,
      o = arguments.length,
      s = o < 3 ? t : null === n ? n = Object.getOwnPropertyDescriptor(t, a) : n;
  if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) s = Reflect.decorate(e, t, a, n);else for (var r = e.length - 1; r >= 0; r--) {
    (i = e[r]) && (s = (o < 3 ? i(s) : o > 3 ? i(t, a, s) : i(t, a)) || s);
  }
  return o > 3 && s && Object.defineProperty(t, a, s), s;
};

Object.defineProperty(o, "__esModule", {
  value: !0
});

var a = e("BaseModuleUI"),
    n = e("NotifyEventType"),
    i = e("GlobalParams"),
    r = e("Game"),
    s = e("ActivityViewUI"),
    l = e("GetZsViewUI"),
    _ = cc._decorator,
    c = _.ccclass,
    d = _.property,
    h = function (e) {
  function t() {
    var t = null !== e && e.apply(this, arguments) || this;
    return t.task_name = null, t.task_info = null, t.schedule_num = null, t.task_exp_label = null, t.go_btn_node = null, t.get_award_node = null, t.get_over_node = null, t.task_index = 0, t.game_task_info = null, t;
  }

  return nn(t, e), t.prototype.initView = function () {
    e.prototype.initView.call(this);
  }, t.prototype.addEvent = function () {
    this.attachEvent(n["default"].SEND_UPDATE_TASK_INFO, this.updateTaskInfo, this);
  }, t.prototype.showTaskInfo = function (e) {
    this.task_index = e.id, this.node.scale = 1, this.game_task_info = e, this.task_name.string = e.name, this.task_info.string = e.info, this.task_exp_label.string = e.exp + " EXP", this.showTaskBtnInfo();
  }, t.prototype.OnClick = function (t) {
    switch (e.prototype.OnClick.call(this, t), t.node.name) {
      case "get_btn":
        this.getTaskAward(1);
        break;

      case "go_btn":
        this.goTaskInfo();
    }
  }, t.prototype.getTaskAward = function (e) {
    var t = i.GlobalParams.PlayerTaskInfo.value;
    t.schedule[this.task_index] = -1, i.GlobalParams.PlayerTaskInfo.value = t, this.emitEvent(n["default"].SEND_UPDATE_ADD_PLAYER_LEVEL_EXP, this.game_task_info.exp * e), this.showTaskBtnInfo();
  }, t.prototype.showTaskBtnInfo = function () {
    var e = i.GlobalParams.PlayerTaskInfo.value.schedule[this.task_index],
        t = this.game_task_info.schedule;
    -1 != e ? (e = e > t ? t : e, this.schedule_num.string = e + "/" + t, this.get_award_node.parent.active = e >= t, this.go_btn_node.active = e < t, this.node.zIndex = this.get_award_node.parent.active ? this.task_index : 20 + this.task_index, this.get_over_node.active = !1) : (this.get_award_node.parent.active = !1, this.go_btn_node.active = !1, this.node.zIndex = 40 + this.task_index, this.get_over_node.active = !0);
  }, t.prototype.updateTaskInfo = function () {
    this.showTaskBtnInfo();
  }, t.prototype.goTaskInfo = function () {
    1 == this.game_task_info.id ? this.uiManager.showPopup("ActivityViewUI", function (e) {
      e.getComponent(s["default"]).showActivityView(1);
    }) : 2 == this.game_task_info.id ? this.uiManager.showPopup("ActivityViewUI", function (e) {
      e.getComponent(s["default"]).showActivityView(0);
    }) : -1 != [3, 4, 8, 9].indexOf(this.game_task_info.id) ? (4 == this.game_task_info.id && (i.GlobalParams.ChangeGameMode = r.GameType.rank_mode), this.uiManager.showPopup("MatchViewUI")) : -1 != [5, 6].indexOf(this.game_task_info.id) ? this.uiManager.showPopup("ShopViewUI") : 7 == this.game_task_info.id ? this.uiManager.showPopup("DSEViewUI") : 10 == this.game_task_info.id && this.uiManager.showPopup("GetZsViewUI", function (e) {
      e.getComponent(l["default"]).showPopupInfoView(0);
    });
  }, oo([d(cc.Label)], t.prototype, "task_name", void 0), oo([d(cc.Label)], t.prototype, "task_info", void 0), oo([d(cc.Label)], t.prototype, "schedule_num", void 0), oo([d(cc.Label)], t.prototype, "task_exp_label", void 0), oo([d(cc.Node)], t.prototype, "go_btn_node", void 0), oo([d(cc.Node)], t.prototype, "get_award_node", void 0), oo([d(cc.Node)], t.prototype, "get_over_node", void 0), oo([c], t);
}(a["default"]);

o["default"] = h;

cc._RF.pop();